package com.hibase.common.util;


import com.hibase.common.entity.User;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class UserContext {

    private static ThreadLocal<User> local = new ThreadLocal<>();

    public static User get() {
        return local.get();
    }

    public static void set(User user) {
        local.set(user);
    }

    public static void clear() {
        if (local.get() != null) {
            local.remove();
        }
    }
}
